/**
 * Created by Administrator on 2017/7/26.
 */
$(function () {
   
    //点击叮嘱按钮出现医生叮嘱界面
       $(".enjoin").click(function () {
           $(".click-to-viewl").css("display","block");
       });

    $(".summarize").click(function () {
        $(".click-to-viewr").css("display","block");
    });
    //截取数据
    var a = window.location.href;
    var ins = a.indexOf('=');
    var aaa = a.slice(ins +1);
    var c = decodeURIComponent(aaa)
    var obj = JSON.parse(c);
    console.log(obj);
    var Obj={};
    var arr=[];
    arr[0]=obj;
    Obj.item=arr;
    console.log(Obj);
   var html=template("id",Obj);
   var id=obj.sPatientHGuid;
    $(".Hospital-details").html(html);

    //通过叮嘱显示跳转页面

    $(".enjoin").attr("href","urge.html?jndex="+JSON.stringify(obj));
    $(".summarize").attr("href","summary.html?index="+JSON.stringify(obj));

    //检查单
    $(".spinner").show();
    $.ajax({
        type:"post",
        url:"http://www.jzxchina.cn/M_AjaxData/M_PatientInfoAjax/GetSZCollectionBill",
        data:{"sPatientHGuid":id},
        dataType: "JSONP",
        success:function (data) {
            console.log(data);
            var  html=template("checklist",{item:data});
            //如果没有数据
           $(".mui-table-view").html(html);
            if(data.length==0){
               $(".checklist-item").html("<p>您的健康良好</p>");
           };
           $(".ishow").on("click",function () {
           console.log($(this))	
               var  num= $(this).data("num");;
               var name=$(this).data("name");

               if($(this).data("ishow")==0||$(this).data("ishow")==1){
                   $(this).attr("href","checklist.html?index="+num+"&name="+name+"&sPatientHGuid="+id+"&id="+JSON.stringify(obj));

               }if($(this).data("ishow")==3){
                   $(this).attr("href","result.html?index="+num+"&name="+name+"&sPatientHGuid="+id+"&id="+JSON.stringify(obj));
               };

           });
            $(".spinner").hide();
        }
    });
     $(".icon-zuo").attr("href","index.html?index=123");
//	$(".icon-zuo").click(function(){
//		history.go(-1);
//	})
})
